<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import="group9.UserStory" %>
<%@ page import="group9.User" %>
<%@ page import="java.util.LinkedList" %>
<html>

<!-- Claudio Herreros, Dylan James, Tyler Berg -->

<%
	User user = (User)session.getAttribute("User");
	
	if (user == null){
	response.sendRedirect("login.jsp");
	}
	UserStory user_story;
	try{
	user_story = ((LinkedList<UserStory>)session.getAttribute("pending")).get(Integer.parseInt(request.getParameter("index")));
	}catch(Exception e){
		user_story = (UserStory)session.getAttribute("UserStory");
	}
	if (user_story == null)
	{
		response.sendRedirect("MyUserStories.jsp");
	}
%>
	<head>
		<link rel="stylesheet" type="text/css" href="styles.css" title="Style 1" />
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
			<title>Estimate User Story</title>
		</head>
	<body>
		<h1>Title<%= user_story.getTitle() %></h1> <span align="right">
		<hr />
	    <p><b>Description:</b></p>
	    <p class="Tab"><%= user_story.getDescription() %></p>
		<% 
		if(!user_story.getTestNotes().equals(null)  && !user_story.getTestNotes().equals("")){
	 	%>
	    <p><b>
	    Test Notes:
	    </b></p>
	    <p class="Tab">
	    <%= user_story.getTestNotes() %>
	    </p>
		<%
		}
		session.setAttribute("UserStory", user_story);
		%>
		<form action="/EstimateUserStory" method="post">
		    <input type="text" name="estimate" />"
		    <input type="submit" value="Estimate" />
		</form>
		<hr/>
		<a href="MyUserStories.jsp">Back!</a>
	</body>
</html>